package com.xls.controllerr;

import com.xls.dto.Result;
import com.xls.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/customers")
public class CustomersController {
    @Autowired
    CustomerService custermersService;

    @GetMapping("/{id}")
    public Result getCustermersById(@PathVariable("id") Long id){
        return Result.ok(custermersService.getById(id));
    }

    @GetMapping("/list")
    public Result getCustermersList(){
        return Result.ok(custermersService.list());
    }

}

